package com.example.framework.baseService;

import com.auth0.jwt.JWT;
import com.auth0.jwt.algorithms.Algorithm;
import com.example.project.entity.UserInfoBean;
import org.springframework.stereotype.Service;

@Service
public class TokenService {


    /**
     * 获取Token
     */
    public String getToken(UserInfoBean user) {
        String token = "";
        token = JWT.create().withAudience(user.getId().toString())
                .sign(Algorithm.HMAC256(user.getPassword()));
        return token;
    }
}
